import numpy as np
import cmath
import PIL.Image as Image

image1 = Image.open("1.jpg")
r, g, b = image1.split()
r_arr = np.array(r)
g_arr = np.array(g)
b_arr = np.array(b)

l_arr = r_arr * 299/1000 + g_arr * 587/1000 + b_arr * 114/1000
image2 = image1.convert("L")
l2_arr = np.array(image2)
# l = image2.split()
# l_arr = np.array(l)
print(l2_arr)
img = Image.fromarray(l2_arr.astype('uint8')).convert("L")
img.show()